package com.apache.uct.dao;

import com.apache.database.db.DaoImpl;

public class ActDaoImpl extends DaoImpl {

	public String getSql(int type) {
		String sql = "";
		switch (type) {
		case 1:
			sql = "select count(*) from Act where 1=1 ";
			break;
		case 2:
			sql = " from Act where 1=1 ";
			break;
		case 3:
			sql = " from Act where fatherId=:fatherId order by orderNum ";
			break;
		case 4:
			sql = " from Act where fatherId=:fatherId and actId in(select actId from ActGive where giveType=:giveType and roleId=:roleId) order by orderNum ";
			break;
		case 5:
			sql = " from Act where 1=1 and actId in ( select actId from ActGive where ( roleId=:userId and (invalidTime is null or invalidTime <=:invalidTime ) ) or roleId in ( select roleId from RoleGive  where userId=:userId) )";
			break;
		case 6:
			sql = " from Act where actId in ( select actId from ActGive where giveType='role' ";
			break;
		case 7:
			sql = " delete from Act where sysEname =:sysEname ";
			break;
		case 8:
			sql = "select count(*) from Act where 1=1 fatherId =:fatherId and actEname=:actEname";
			break;
		default:
			sql = "select count(*) from Act where 1=1 ";
		}
		return sql;
	}

	public void initSystemCache() {
	}
}
